package cn.bluethink.eguan.core.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.github.pagehelper.Page;

import cn.bluethink.eguan.core.entity.EgStaffEntity;
import cn.bluethink.eguan.core.entity.StaffEntity;
import cn.bluethink.eguan.filter.NameFilter;
import tk.mybatis.mapper.common.Mapper;

public interface EgStaffMapper extends Mapper<EgStaffEntity> {

    /**
     * 批量新增驿馆伙计
     * 
     * @param list
     * @return
     * @throws Exception
     */
    public int insertStaffs(@Param("list") List<EgStaffEntity> list) throws Exception;

    /**
     * 批量移除驿馆伙计
     * 
     * @param egid
     * @param uids
     * @return
     * @throws Exception
     */
    public int removeStaffs(@Param("egid") Long egid, @Param("uids") List<Long> uids) throws Exception;

    /**
     * 更新用户当前位置，主要用于删除驿馆伙计时，更新驿馆伙计所在位置
     * 
     * @param posOid
     * @param posOtype
     * @param uids
     * @param oldPosOid
     * @param oldPosOtype
     * @return
     * @throws Exception
     */
    public int updateUsersPos(@Param("posOid") Long posOid, @Param("posOtype") Integer posOtype,
            @Param("list") List<Long> uids, @Param("oldPosOid") Long oldPosOid,
            @Param("oldPosOtype") Integer oldPosOtype) throws Exception;

    /**
     * 过滤查询伙计列表
     * 
     * @param filter
     * @return
     * @throws Exception
     */
    public Page<StaffEntity> query(@Param("filter") NameFilter filter) throws Exception;

    /**
     * 判断用户是否为当前门派驿馆中的掌柜
     * 
     * @param fid
     * @param uid
     * @return
     * @throws Exception
     */
    public int bShopkeeper(@Param("fid") Long fid, @Param("uid") Long uid) throws Exception;
}
